package com.jwaoo.chat;

import android.arch.persistence.room.Embedded;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.Ignore;
import android.arch.persistence.room.PrimaryKey;
import com.jwaoo.chat.attachment.FileAttachment;
import java.io.Serializable;

/**
 * Created by jwaoo on 2017/6/30.
 */
@Entity(tableName = "message")
public class Message implements Serializable{
    @PrimaryKey
    private int msgid;
    private String content;//消息内容
    private int sessiontype;//消息类型
    private String avtar;//头像地址
    private long timestamp;//消息时间搓
    private String nickname;//对方昵称
    private int isRead;//消息是否已读,1已读，2未读
    private int msgtype;//消息类型
    private int direct;//发出去的消息0，接受的消息1
    private int state;//消息状态
    private int snap;
    private int friend;
    @Ignore
    private int time;
    @Ignore
    private boolean isReSend = false;
    @Embedded
    private FileAttachment attachment;//附件信息
    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public int getSnap() {
        return snap;
    }

    public void setSnap(int snap) {
        this.snap = snap;
    }

    public int getDirect() {
        return direct;
    }

    public void setDirect(int direct) {
        this.direct = direct;
    }

    public int getMsgtype() {
        return msgtype;
    }

    public void setMsgtype(int msgtype) {
        this.msgtype = msgtype;
    }

    public int getIsRead() {
        return isRead;
    }

    public int getMsgid() {
        return msgid;
    }

    public void setMsgid(int msgid) {
        this.msgid = msgid;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getSessiontype() {
        return sessiontype;
    }

    public void setSessiontype(int sessiontype) {
        this.sessiontype = sessiontype;
    }

    public void setIsRead(int isRead) {
        this.isRead = isRead;
    }

    public String getAvtar() {
        return avtar;
    }

    public void setAvtar(String avtar) {
        this.avtar = avtar;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public boolean isTheSame(Message message){
        if (message.getMsgid() == this.getMsgid()) return true;
        return false;
    }

    public boolean isReSend() {
        return isReSend;
    }

    public void setReSend(boolean reSend) {
        isReSend = reSend;
    }

    public FileAttachment getAttachment() {
        return attachment;
    }

    public void setAttachment(FileAttachment attachment) {
        this.attachment = attachment;
    }

    public int getFriend() {
        return friend;
    }

    public void setFriend(int friend) {
        this.friend = friend;
    }

    public int getTime() {
        return time;
    }

    public void setTime(int time) {
        this.time = time;
    }
}
